#include "Employee.h"
#include "Memento.h"
#include "CareTaker.h"
#include "Organizer.h"

#include <iostream>

using namespace std;

int main()
{
	Employee employee;
	Organizer org(&employee);
	CareTaker careTaker;
	Memento* pMem;

	cout<<"Original state:"<<endl;
	employee.name = "Jackie";
	employee.age = 22;
	employee.show();
	cout<<endl;

	pMem = org.createMemento();
	careTaker.pushMemento(pMem);

	cout<<"Change state to be:"<<endl;
	employee.name = "Tom";
	employee.age = 23;
	employee.show();
	cout<<endl;

	pMem = careTaker.popMemento();
	org.restoreToMemento(pMem);

	cout<<"Restore to original state:"<<endl;
	employee.show();
	cout<<endl;

	return 0;
}
